<template>
    <div class="yx-sym">
        <van-nav-bar
            title="严选专栏"
            left-arrow
             @click-left="$router.back()"
        />
        <div class="content">
            <div class="new" v-for="item in list" :key="item.id" :style="{
                backgroundImage: 'url(' + item.pic + ')'
            }">
                <h3 class="ellipse" v-html="item.title"></h3>
                <p class="ellipse">{{item.descript}}</p>

                <button @click="goDetail(item.id)">查看详情</button>
            </div>
        </div>
    </div>
</template>

<script>
import { getNews } from '@/api/home'
export default {
    name: '',
    data() { 
        return {
            list: []
        }
    },
    created() {
        getNews().then(res => {
            // console.log(res);
            this.list = res.data
        })
    },
    methods:{
        goDetail(id) {
            this.$router.push({
                path: '/detail',
                query: {
                    id
                }
            })
        }
    },
}
</script>

<style scoped lang="scss">
.yx-sym {
    overflow: auto;
}
.content {
    padding: 0 20px;
}
.new {
    width: 100%;
    height: 370px;
    margin-bottom: 20px;
    color: #fff;
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center;
    text-align: center;
    padding-top: 100px;
    h3 {
        font-size: 40px;
        margin: 0 auto;
        margin-bottom: 40px;
        width: 500px;
        
    }
    p {
        font-size: 24px;
        width: 500px;
        margin: 0 auto;
    }

    button {
        width: 160px;
        height: 60px;
        border-radius: 60px;
        text-align: center;
        border: 1px solid #fff;
        outline: none;
        background-color: transparent;
        font-size: 28px;
        margin-top: 30px;
    }
}   
</style>